<?php

Prado::using('System.Web.UI.WebControls.TTextBox');

class TOpenIdURL extends TTextBox
{

	const	OpenIdLogo	= 'openid-icon-small.gif';

	private $_publishedAssetsUrl;

	protected function getTagName()
	{
		return 'input';
	}

	//
	// We need to publish the OpenId logo
	public function onPreRender($param)
	{
		$path		= PortalUtil::PathName(Prado::getPathOfNamespace('Application.Common.3rdParty.OpenId.assets'));
        $publish	= $path . self::OpenIdLogo;
		$this->_publishedAssetsUrl = Prado::getApplication()->getAssetManager()->publishFilePath($publish);

		$this->Columns	= 45;
	}

	//
	// We need to add the logo to the textbox
	protected function addAttributesToRender($writer)
	{
		parent::addAttributesToRender($writer);
		$style = "background: url('" . $this->_publishedAssetsUrl . "') no-repeat #FFF 5px;padding-left:25px;";
		$writer->addAttribute('style',$style);
	}


	public function getName()
	{
		return $this->getViewState('Name','');
	}

	public function setName($value)
	{
		return $this->setViewState('Name',$value,'');
	}
}

?>